﻿#pragma once
#include "FCMiddleware_global.h"

namespace FCMiddleware
{
    class FCMIDDLEWARE_EXPORT Depacker
	{
	public:
		Depacker();
		~Depacker();

	protected:
        const static unsigned int DEPACKER_BUFF_SIZE = 1024*1024;
		unsigned char _buf[DEPACKER_BUFF_SIZE];
        unsigned int _buf_used;

	protected:
        void remove(unsigned int size);

	public:
		void clear();

        unsigned short push(unsigned int size);
        unsigned short push(unsigned char* data, unsigned int size);
        unsigned char* buf(unsigned int* size);

		virtual unsigned int depack(QByteArray* frame) = 0;
	};
}

